package com.demo.job.elasticjob.lite;

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.dataflow.job.DataflowJob;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class ElasticJobLiteDataflowJob implements DataflowJob<Integer> {
    @Override
    public List<Integer> fetchData(ShardingContext shardingContext) {
        String jobParameter = shardingContext.getJobParameter();
        Integer value = Integer.valueOf(jobParameter);
        return List.of(value);
    }

    @Override
    public void processData(ShardingContext shardingContext, List<Integer> list) {
        log.info("list:{}", list);
    }
}
